import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const ThirdPartyInspectionMeta: IPublicTypeComponentMetadata = {
  componentName: 'ThirdPartyInspection',
  title: '第三方巡查',
  category: '信息展示',
  group: '消防安全',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'ThirdPartyInspection',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '容器宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '容器高度'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '容器背景色'
    },
    {
      name: 'borderRadius',
      propType: 'number',
      description: '容器圆角'
    },
    {
      name: 'borderColor',
      propType: 'string',
      description: '边框颜色'
    },
    {
      name: 'borderOpacity',
      propType: 'number',
      description: '边框透明度'
    },
    {
      name: 'inspectionItems',
      propType: 'array',
      description: '巡查项目配置'
    },
    {
      name: 'itemSpacing',
      propType: 'number',
      description: '项目间距'
    },
    {
      name: 'itemWidth',
      propType: 'number',
      description: '项目宽度'
    },
    {
      name: 'itemHeight',
      propType: 'number',
      description: '项目高度'
    },
    {
      name: 'titleFontSize',
      propType: 'number',
      description: '标题字体大小'
    },
    {
      name: 'titleColor',
      propType: 'string',
      description: '标题颜色'
    },
    {
      name: 'titleFontFamily',
      propType: 'string',
      description: '标题字体'
    },
    {
      name: 'titleFontWeight',
      propType: 'number',
      description: '标题字体粗细'
    },
    {
      name: 'titleLineHeight',
      propType: 'number',
      description: '标题行高'
    },
    {
      name: 'titleLetterSpacing',
      propType: 'number',
      description: '标题字间距'
    },
    {
      name: 'valueFontSize',
      propType: 'number',
      description: '数值字体大小'
    },
    {
      name: 'valueColor',
      propType: 'string',
      description: '数值颜色'
    },
    {
      name: 'valueFontFamily',
      propType: 'string',
      description: '数值字体'
    },
    {
      name: 'valueFontWeight',
      propType: 'number',
      description: '数值字体粗细'
    },
    {
      name: 'valueLineHeight',
      propType: 'number',
      description: '数值行高'
    },
    {
      name: 'valueLetterSpacing',
      propType: 'number',
      description: '数值字间距'
    },
    {
      name: 'valueBackground',
      propType: 'string',
      description: '数值背景'
    },
    {
      name: 'iconSize',
      propType: 'number',
      description: '图标大小'
    },
    {
      name: 'iconSpacing',
      propType: 'number',
      description: '图标间距'
    },
    {
      name: 'tableColumns',
      propType: 'array',
      description: '表格列配置'
    },
    {
      name: 'tableDataSource',
      propType: 'array',
      description: '表格数据源'
    },
    {
      name: 'tableHeight',
      propType: 'number',
      description: '表格高度'
    },
    {
      name: 'tableHeaderHeight',
      propType: 'number',
      description: '表头高度'
    },
    {
      name: 'tableRowHeight',
      propType: 'number',
      description: '行高度'
    },
    {
      name: 'tableMaxRows',
      propType: 'number',
      description: '最大显示行数'
    },
    {
      name: 'tableShowHeader',
      propType: 'bool',
      description: '显示表头'
    },
    {
      name: 'tableHeaderTextColor',
      propType: 'string',
      description: '表头文字颜色'
    },
    {
      name: 'tableRowTextColor',
      propType: 'string',
      description: '行文字颜色'
    },
    {
      name: 'tableHeaderFontSize',
      propType: 'number',
      description: '表头字体大小'
    },
    {
      name: 'tableRowFontSize',
      propType: 'number',
      description: '行字体大小'
    },
    {
      name: 'tableColumnSpacing',
      propType: 'number',
      description: '列间距'
    },
    {
      name: 'tableShowBorder',
      propType: 'bool',
      description: '显示边框'
    },
    {
      name: 'tableHoverRowColor',
      propType: 'string',
      description: '悬停行颜色'
    },
    {
      name: 'tableSelectedRowColor',
      propType: 'string',
      description: '选中行颜色'
    },
    {
      name: 'tableEmptyText',
      propType: 'string',
      description: '空数据提示文字'
    },
    {
      name: 'tableLoading',
      propType: 'bool',
      description: '加载状态'
    },
    {
      name: 'tableTheme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'tableHeaderBackgroundImage',
      propType: 'string',
      description: '表头背景图片'
    },
    {
      name: 'tableHeaderBackgroundColor',
      propType: 'string',
      description: '表头背景颜色'
    },
    {
      name: 'tableAlternateRowBackgroundColor',
      propType: 'string',
      description: '交替行背景颜色'
    },
    {
      name: 'onItemClick',
      propType: 'func',
      description: '项目点击事件'
    },
    {
      name: 'onTableRowClick',
      propType: 'func',
      description: '表格行点击事件'
    },
    {
      name: 'onTableRowDoubleClick',
      propType: 'func',
      description: '表格行双击事件'
    },
    {
      name: 'onTableHeaderClick',
      propType: 'func',
      description: '表头点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      // 容器配置
      {
        name: 'container',
        type: 'group',
        display: 'accordion',
        title: {
          label: '容器配置',
        },
        items: [
          {
            name: 'width',
            title: { label: '容器宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 500 }
          },
          {
            name: 'height',
            title: { label: '容器高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 434 }
          },
          {
            name: 'backgroundColor',
            title: { label: '容器背景色' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'linear-gradient(180deg, #14191F 0%, #3C4249 100%), linear-gradient(178deg, rgba(9,11,13,0) 0%, #26394D 100%), radial-gradient(185% 43% at 53% -3%, rgba(166,213,255,0.5) 0%, rgba(166,209,255,0) 24%, rgba(179,212,255,0) 100%)' }
          },
          {
            name: 'borderRadius',
            title: { label: '容器圆角' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0 }
          },
          {
            name: 'borderColor',
            title: { label: '边框颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#4D5966' }
          },
          {
            name: 'borderOpacity',
            title: { label: '边框透明度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.25 }
          }
        ]
      },
      // 上方区域配置
      {
        name: 'header',
        type: 'group',
        display: 'accordion',
        title: {
          label: '上方区域配置',
        },
        items: [
          {
            name: 'inspectionItems',
            title: { label: '巡查项目配置' },
            setter: { componentName: 'JsonSetter', isRequired: false, initialValue: [
              { title: '排查问题', value: '1148', iconPath: 'http://localhost:8085/static/images/xiaofanganquan/编组51.png' },
              { title: '复查问题', value: '1148', iconPath: 'http://localhost:8085/static/images/xiaofanganquan/编组51备份.png' }
            ]}
          },
          {
            name: 'itemSpacing',
            title: { label: '项目间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 40 }
          },
          {
            name: 'itemWidth',
            title: { label: '项目宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 210 }
          },
          {
            name: 'itemHeight',
            title: { label: '项目高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 46 }
          }
        ]
      },
      // 标题配置
      {
        name: 'title',
        type: 'group',
        display: 'accordion',
        title: {
          label: '标题配置',
        },
        items: [
          {
            name: 'titleFontSize',
            title: { label: '标题字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
          },
          {
            name: 'titleColor',
            title: { label: '标题颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
          },
          {
            name: 'titleFontFamily',
            title: { label: '标题字体' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'SourceHanSansSC' }
          },
          {
            name: 'titleFontWeight',
            title: { label: '标题字体粗细' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 400 }
          },
          {
            name: 'titleLineHeight',
            title: { label: '标题行高' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 24 }
          },
          {
            name: 'titleLetterSpacing',
            title: { label: '标题字间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.57 }
          }
        ]
      },
      // 数值配置
      {
        name: 'value',
        type: 'group',
        display: 'accordion',
        title: {
          label: '数值配置',
        },
        items: [
          {
            name: 'valueFontSize',
            title: { label: '数值字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 20 }
          },
          {
            name: 'valueColor',
            title: { label: '数值颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
          },
          {
            name: 'valueFontFamily',
            title: { label: '数值字体' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'DINAlternate' }
          },
          {
            name: 'valueFontWeight',
            title: { label: '数值字体粗细' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 700 }
          },
          {
            name: 'valueLineHeight',
            title: { label: '数值行高' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 28 }
          },
          {
            name: 'valueLetterSpacing',
            title: { label: '数值字间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.71 }
          },
          {
            name: 'valueBackground',
            title: { label: '数值背景' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'linear-gradient(90deg, #FFFFFF 0%, #81C6FF 100%)' }
          }
        ]
      },
      // 图标配置
      {
        name: 'icon',
        type: 'group',
        display: 'accordion',
        title: {
          label: '图标配置',
        },
        items: [
          {
            name: 'iconSize',
            title: { label: '图标大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 20 }
          },
          {
            name: 'iconSpacing',
            title: { label: '图标间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 8 }
          }
        ]
      },
      // 表格配置
      {
        name: 'table',
        type: 'group',
        display: 'accordion',
        title: {
          label: '表格配置',
        },
        items: [
          {
            name: 'tableColumns',
            title: { label: '表格列配置' },
            setter: { componentName: 'JsonSetter', isRequired: false, initialValue: [
              {
                key: 'inspectionType',
                title: '巡查类型',
                width: 120,
                align: 'center',
                dataIndex: 'inspectionType'
              },
              {
                key: 'inspectionArea',
                title: '巡查区域',
                width: 150,
                align: 'center',
                dataIndex: 'inspectionArea'
              },
              {
                key: 'inspectionTime',
                title: '巡查时间',
                width: 180,
                align: 'center',
                dataIndex: 'inspectionTime'
              },
              {
                key: 'status',
                title: '状态',
                width: 100,
                align: 'center',
                dataIndex: 'status'
              }
            ]}
          },
          {
            name: 'tableDataSource',
            title: { label: '表格数据源' },
            setter: { componentName: 'JsonSetter', isRequired: false, initialValue: [
              {
                key: '1',
                inspectionType: '消防安全',
                inspectionArea: 'A区-1楼',
                inspectionTime: '2025-01-15 09:30:00',
                status: '正常'
              },
              {
                key: '2',
                inspectionType: '设备检查',
                inspectionArea: 'B区-2楼',
                inspectionTime: '2025-01-15 10:15:00',
                status: '异常'
              },
              {
                key: '3',
                inspectionType: '环境监测',
                inspectionArea: 'C区-3楼',
                inspectionTime: '2025-01-15 11:00:00',
                status: '正常'
              }
            ]}
          },
          {
            name: 'tableHeight',
            title: { label: '表格高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 300 }
          },
          {
            name: 'tableHeaderHeight',
            title: { label: '表头高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 40 }
          },
          {
            name: 'tableRowHeight',
            title: { label: '行高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 40 }
          },
          {
            name: 'tableMaxRows',
            title: { label: '最大显示行数' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 8 }
          },
          {
            name: 'tableShowHeader',
            title: { label: '显示表头' },
            setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
          },
          {
            name: 'tableHeaderTextColor',
            title: { label: '表头文字颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#56A5FF' }
          },
          {
            name: 'tableRowTextColor',
            title: { label: '行文字颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
          },
          {
            name: 'tableHeaderFontSize',
            title: { label: '表头字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
          },
          {
            name: 'tableRowFontSize',
            title: { label: '行字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 14 }
          },
          {
            name: 'tableColumnSpacing',
            title: { label: '列间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0 }
          },
          {
            name: 'tableShowBorder',
            title: { label: '显示边框' },
            setter: { componentName: 'BoolSetter', isRequired: false, initialValue: false }
          },
          {
            name: 'tableHoverRowColor',
            title: { label: '悬停行颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(86,165,255,0.2)' }
          },
          {
            name: 'tableSelectedRowColor',
            title: { label: '选中行颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(86,165,255,0.3)' }
          },
          {
            name: 'tableEmptyText',
            title: { label: '空数据提示文字' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: '暂无数据' }
          },
          {
            name: 'tableLoading',
            title: { label: '加载状态' },
            setter: { componentName: 'BoolSetter', isRequired: false, initialValue: false }
          },
          {
            name: 'tableTheme',
            title: { label: '主题' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'dark' }
          },
          {
            name: 'tableHeaderBackgroundImage',
            title: { label: '表头背景图片' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz54.png' }
          },
          {
            name: 'tableHeaderBackgroundColor',
            title: { label: '表头背景颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(0,0,0,0.3)' }
          },
          {
            name: 'tableAlternateRowBackgroundColor',
            title: { label: '交替行背景颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(16,85,163,0.18)' }
          }
        ]
      }
    ],
    supports: {
      style: true,
      className: true,
      events: ['onItemClick', 'onTableRowClick', 'onTableRowDoubleClick', 'onTableHeaderClick', 'onClick']
    }
  }
};
const showData = false
const height = 204
const snippets: IPublicTypeSnippet[] = [
  {
    title: '第三方巡查',
    screenshot: '',
    schema: {
      componentName: 'ThirdPartyInspection',
      props: {
        showData: showData, // 和日常检查通用一个组件
        width: 500,
        height: showData ? (height + 110) : height,
        backgroundColor: 'linear-gradient(180deg, #14191F 0%, #3C4249 100%), linear-gradient(178deg, rgba(9,11,13,0) 0%, #26394D 100%), radial-gradient(185% 43% at 53% -3%, rgba(166,213,255,0.5) 0%, rgba(166,209,255,0) 24%, rgba(179,212,255,0) 100%)',
        borderRadius: 0,
        borderColor: '#4D5966',
        borderOpacity: 0.25,
        inspectionItems: [
          { title: '排查问题', value: '1148', iconPath: 'http://localhost:8085/static/images/xiaofanganquan/编组51.png' },
          { title: '复查问题', value: '1148', iconPath: 'http://localhost:8085/static/images/xiaofanganquan/编组51备份.png' }
        ],
        itemSpacing: 40,
        itemWidth: 210,
        itemHeight: 46,
        titleFontSize: 16,
        titleColor: 'rgba(255,255,255,0.9)',
        titleFontFamily: 'SourceHanSansSC',
        titleFontWeight: 400,
        titleLineHeight: 24,
        titleLetterSpacing: 0.57,
        valueFontSize: 20,
        valueColor: '#1AD7FF',
        valueFontFamily: 'DINAlternate',
        valueFontWeight: 700,
        valueLineHeight: 28,
        valueLetterSpacing: 0.71,
        valueBackground: 'linear-gradient(90deg, #FFFFFF 0%, #81C6FF 100%)',
        iconSize: 20,
        iconSpacing: 8,
        tableColumns: [
          {
            key: 'inspectionType',
            title: '巡查类型',
            width: 120,
            align: 'center',
            dataIndex: 'inspectionType'
          },
          {
            key: 'inspectionArea',
            title: '巡查区域',
            width: 150,
            align: 'center',
            dataIndex: 'inspectionArea'
          },
          {
            key: 'inspectionTime',
            title: '巡查时间',
            width: 180,
            align: 'center',
            dataIndex: 'inspectionTime'
          },
          {
            key: 'status',
            title: '状态',
            width: 100,
            align: 'center',
            dataIndex: 'status'
          }
        ],
        tableDataSource: [
          {
            key: '1',
            inspectionType: '消防安全',
            inspectionArea: 'A区-1楼',
            inspectionTime: '2025-01-15 09:30:00',
            status: '正常'
          },
          {
            key: '2',
            inspectionType: '设备检查',
            inspectionArea: 'B区-2楼',
            inspectionTime: '2025-01-15 10:15:00',
            status: '异常'
          },
          {
            key: '3',
            inspectionType: '环境监测',
            inspectionArea: 'C区-3楼',
            inspectionTime: '2025-01-15 11:00:00',
            status: '正常'
          }
        ],
        tableHeaderHeight: 40,
        tableRowHeight: 40,
        tableMaxRows: 8,
        tableShowHeader: true,
        tableHeaderTextColor: '#56A5FF',
        tableRowTextColor: 'rgba(255,255,255,0.9)',
        tableHeaderFontSize: 16,
        tableRowFontSize: 14,
        tableColumnSpacing: 0,
        tableShowBorder: false,
        tableHoverRowColor: 'rgba(86,165,255,0.2)',
        tableSelectedRowColor: 'rgba(86,165,255,0.3)',
        tableEmptyText: '暂无数据',
        tableLoading: false,
        tableTheme: 'dark',
        tableHeaderBackgroundImage: 'http://localhost:8085/static/images/qixiangfangzhai/bz54.png',
        tableHeaderBackgroundColor: 'rgba(0,0,0,0.3)',
        tableAlternateRowBackgroundColor: 'rgba(16,85,163,0.18)'
      }
    }
  }
];

export default {
  ...ThirdPartyInspectionMeta,
  snippets
};
